To share objects in VRML, first include the following PROTO at the top of your file:

PROTO Sony_BindSharedNode [ 
			    field SFNode transformNode NULL
                            field SFNode scriptNode NULL ] { }
This node is a Sony extension node which will be treated appropriately by CP, but should be ignored by other browsers.

Next, add a script and a Sony_BindSharedNode for every "shared object" you want to use. Here is an example:

DEF ScriptForSharedObj Script {
  field SFNode sharedobj USE SharedObj
  eventIn SFBool touched
  eventIn SFString rpc_touched
  eventIn SFString rpc_rotateBox
  url "shareclick.class"
}

Sony_BindSharedNode {
  transformNode USE SharedObj
  scriptNode USE ScriptForSharedObj
}

These nodes assume there is a Transform node called "SharedObj" that we want to activate. The need for rpc_touched and rpc_change_color will be explained in a later example. The formal definition of Sony_BindSharedNode and rules for its use are here.


Back to Tutorial Seven main page